const uniID = require('uni-id-common');
const db = uniCloud.database();
//校验token
const getUsetInfo = async (that) => {
    const token = that.getUniIdToken();
    const clientInfo = that.getClientInfo();
    // 创建uni-id实例
    const uniIDIns = uniID.createInstance({
        clientInfo
    })
    return await uniIDIns.checkToken(token);
}
//获取商家信息
const getshopId = async (that) => {
    const uid = that.userInfo.uid;
    let res = await db.collection('mall-brand').where({
        user_id: uid
    }).get();
    return res.data[0]._id;
}
module.exports = {
    getUsetInfo,
    getshopId
}